package week1;

public class Ex7 {
    public static void main(String[] args) {
        int n = 100000000;
        int[] prime = new int[n];
        int c = 0;
        boolean[] isVisit = new boolean[n+1];
        for (int i = 2; i <= n; ++i){
            if (!isVisit[i]){
                prime[++c] = i;
                if (c == 10001){
                    System.out.println(prime[c]);
                    break;
                }
            }
            for (int j = 1; j <= c && i * prime[j] <= n; j++) {
                isVisit[i * prime[j]] = true;
                if (i % prime[j] == 0){
                    break;
                }
            }
        }
    }
}
